home *** CD-ROM | disk | FTP | other *** search
/ Aminet 37 / Aminet 37 (2000)(Schatztruhe)[!][Jun 2000].iso / Aminet / comm / bbs / cit_src_AD08.lha / verify.c < prev    next >
C/C++ Source or Header  |  1998-06-14  |  28KB  |  891 lines

  1. /*  Citadel Verify Database */
  2. #include <stdio.h>
  3. #include <string.h>
  4. #include "ctdl.h"
  5. #include "c68door.h"
  6. extern CONFIG      cfg;            /* A buncha variables           */
  7. extern logBuffer   logBuf;         /* Pippul buffer                */
  8. extern FILE        *logfl;         /* log file descriptor          */
  9. extern LogTable    *logTab;
  10. extern int         thisLog;
  11. extern FILE            *netfl, *roomfl;
  12. extern NetBuffer   netBuf;
  13. extern NetTable    *netTab;
  14. extern rTable      *roomTab;         /* RAM index of rooms              */
  15. extern aRoom        roomBuf;         /* room buffer    */
  16. extern EVENT       *EventTab;        /* Events Table */
  17. extern int          TopFloor;        /* limit on floor */
  18. extern struct floor  *FloorTab;
  19. FILE            *netLog=stdout;
  20.  
  21. #define max(x,y)        ((x) > (y) ? (x) : (y))
  22.  
  23. void Process_Msg(MessageBuffer  *msg);
  24. void Do_Room_Stats(long total);
  25. void Do_Message(MessageBuffer  *);
  26. void Verify_Messages(void);
  27. int MsgLen(MessageBuffer  *);
  28. void ShowHash(void);
  29. void showlog(int);
  30. char *LastOn(long lastdate, char s);
  31. void Do_Boolean(char *,short,short);
  32. void Verify_Config(void);
  33. void Verify_Log(void);
  34. void Verify_Room(void);
  35. void Verify_Floor(void);
  36. void Verify_Events(void);
  37. void crashout(char *);
  38. void Check_codeBuf(char *,long,short);
  39. void Check_Shared(void);
  40. void Do_nflags(struct nflags *);
  41. void Do_Multi_Net_Data(MULTI_NET_DATA);
  42. void Do_Shared_Room(SharedRoom *);
  43. void Do_Door_Data(void);
  44. void Do_Net_Data(void);
  45. void Do_NetBuf_Data(int slot);
  46. void Process_Other_Room_Data(int Index);
  47.  
  48. short Vflag;   /* TRUE - Verbose output( config) */
  49. short Lflag;   /* TRUE - Verbose output( user log) */
  50. short Nflag;   /* TRUE - Verbose output( ctdlnet.sys ) */
  51. short Rflag;   /* TRUE - Verbose output( Room data ) */
  52. short Dflag;   /* TRUE - Verbose output(Doors data ) */
  53. short Mflag;   /* TRUE - Verbose output(Message data ) */
  54. short Eflag;   /* TRUE - Process Event data */
  55. short Fflag;   /* TRUE - Process Floor Table */
  56. short sfflag;  /* TRUE - Message Dump is Multiple line */
  57.  
  58. char MControl;    /* selective dump control */
  59. int  mPrintf(char *format, ...) {return 0; }  /* stub to quiet the linker */
  60.  
  61.  
  62. void crashout(str)
  63. char *str;
  64.   {
  65.   printf(str);
  66.   exit(10);
  67.  
  68.   }
  69. int  main(int,char **);
  70. int  main(argc,argv)
  71. int  argc;
  72. char **argv;
  73.   {
  74.   SYS_FILE fn;
  75.   /* Process CONFIG  */
  76.   cfg.weAre = UTILITY;
  77.   sfflag = TRUE;
  78.   if( argc > 1 )
  79.     {
  80.     Fflag = Eflag = Dflag = Rflag = Vflag = Lflag = Mflag = Nflag = FALSE;
  81.     MControl = '\0';
  82.     }
  83.   else Fflag =  Eflag = Dflag = Rflag = Vflag = Lflag = Mflag = Nflag = TRUE;  /* default is all */
  84.   printf("Citadel Verify Database Utility Version %s\n", VERSION_NAME);
  85.   for( ;--argc>0; )
  86.     {
  87.     if( *argv[argc] == '-' )
  88.       {
  89.       switch ( argv[argc][1])
  90.         {
  91.         case 'a' :
  92.         case 'A' : Fflag = Mflag = Eflag = Dflag = Lflag = Vflag = Rflag = Nflag = TRUE;break;
  93.         case 'd' :
  94.         case 'D' : Dflag = TRUE;break;
  95.         case 'e' :
  96.         case 'E' : Eflag = TRUE;break;
  97.         case 'f' :
  98.         case 'F' : Fflag = TRUE;break;
  99.         case 'l' :
  100.         case 'L' : Lflag = TRUE;break;
  101.         case 'm' :
  102.         case 'M' :
  103.           Mflag = TRUE;
  104.           if( argv[argc][2] == 'a' ||  argv[argc][2] == 'A')
  105.             MControl = 'A';
  106.           if( argv[argc][2] == 'p' ||  argv[argc][2] == 'P')
  107.             MControl = 'P';
  108.           break;
  109.         case 'n' :
  110.         case 'N' : Nflag = TRUE;break;
  111.         case 'r' :
  112.         case 'R' : Rflag = TRUE;break;
  113.         case 'v' :
  114.         case 'V' : Vflag = TRUE;break;
  115.         case 's' :
  116.         case 'S' : sfflag = FALSE; break;
  117.         default:
  118.         printf("illegal option ignored:%s\n",argv[argc]);
  119.         printf(" Valid options are:\n");
  120.         printf("   -L User Log data  -V config data\n");
  121.         printf("   -R room data      -M Messages data\n");
  122.         printf("   -N net data       -E Event data        -S one line message data\n");
  123.         printf("   -D Door Data      -F Floor data        -A All of the Above\n");
  124.         };
  125.  
  126.       };
  127.  
  128.     };
  129.   if (!readSysTab(FALSE, TRUE)) exit(100);
  130.   Verify_Config();             /* Verify the data in the main database */
  131.   /* Process the User Log */
  132.   sprintf(fn, "%sctdllog.sys", &cfg.logArea);
  133.   if ((logfl = fopen(fn, "rb")) == NULL)
  134.     {
  135.     printf("Can't open the Citadel log!\n");
  136.     exit(1);
  137.  
  138.     }
  139.   initLogBuf(&logBuf);
  140.   Verify_Log();
  141.   if( cfg.BoolFlags.netParticipant )
  142.     {
  143.     /* process network information */
  144.     sprintf(fn, "%sctdlnet.sys", &cfg.netArea);
  145.     openFile(fn, &netfl);
  146.     initNetBuf(&netBuf);
  147.  
  148.     };
  149.   /* open room file */
  150.   sprintf(fn, "%sctdlroom.sys", &cfg.roomArea);
  151.   openFile(fn, &roomfl);
  152.   initRoomBuf(&roomBuf);
  153.   Verify_Room();
  154.   fclose(roomfl);
  155.   /* close room file */
  156.   Verify_Floor();
  157.   Do_Door_Data();
  158.   Verify_Messages();    /* process the messages */
  159.   Verify_Events();      /* Event Data processing */
  160.   return 0;
  161.   }
  162.  
  163. struct  namelist
  164.   {
  165.   char *GenName;
  166.   int  GenVal;
  167.  
  168.   };
  169.  
  170. typedef struct namelist GenList;
  171.  
  172.   /***  INDENT-OFF ***/
  173. #define MAXDAYS  (8)
  174. #define MAXTYPES (3)
  175.  
  176. static GenList EvnDays[MAXDAYS] =
  177.   {
  178.     {    "Sun", SUNDAYS     },    {    "Mon", MONDAYS     },
  179.     {    "Tue", TUESDAYS    },    {    "Wed", WEDNESDAYS  },
  180.     {    "Thu", THURSDAYS   },    {    "Fri", FRIDAYS     },
  181.     {    "Sat", SATURDAYS   },    {    "All", ALL_DAYS    }
  182.   };
  183.  
  184. static GenList EvnTypes[MAXTYPES] =
  185.   {
  186.     {    "preempt",     TYPREEMPT  },    {    "non-preempt", TYNON      },
  187.     {    "quiet",       TYQUIET    }
  188.   };
  189.  
  190.  
  191. static GenList EvCls[EVENT_CLASS_COUNT] =
  192.   {
  193.     {    "network",             CLNET        },
  194.     {    "external",            CLEXTERN     },
  195.     {    "relative",            CLREL        },
  196.     {    "dl-time",             CL_DL_TIME   },
  197.     {    "anytime-net",         CL_ANYTIME_NET   },
  198.     {    "door-limit",          CL_DOOR_TIME },
  199.     {    "autodoor",            CL_AUTODOOR  },
  200.     {    "chat-on",             CL_CHAT_ON   },
  201.     {    "chat-off",            CL_CHAT_OFF  },
  202.     {    "redirect",            CL_REDIRECT  },
  203.     {    "newusers-allowed",    CL_NEWUSERS_ALLOWED   },
  204.     {    "newusers-disallowed", CL_NEWUSERS_DISALLOWED   },
  205.     {    "until-done-net",      CL_UNTIL_NET  },
  206.     {    "netcache",            CL_NETCACHE   },
  207.     };
  208.  
  209.  /**  INDENT-ON **/
  210. char *fake = "Unknown nnn  ";
  211.  
  212. char *Look_Up(int value,  GenList list[], int limit )
  213.  {
  214.  int i;
  215.  for( i=0; i<limit; i++) if( list[i].GenVal == value ) return list[i].GenName;
  216.  sprintf(&fake[8],"%3d",value);
  217.  return fake;
  218.  }
  219.  
  220. void Verify_Floor()
  221.   {
  222.   int rover;
  223.   for ( rover=0; rover < TopFloor; rover++)
  224.     {
  225.     if( FloorTab[rover].FlInuse )
  226.       {
  227.       printf(" Floor slot[%d] in use  Name:%20s Moderator:%s\n",
  228.         rover, FloorTab[rover].FlName,
  229.        ( FloorTab[rover].FlModerator[0] != '\0' ? FloorTab[rover].FlModerator : "No Moderator") );
  230.       }
  231.     else  printf(" Floor slot[%d] not in use\n",rover);
  232.  
  233.     };
  234.   }
  235.  
  236. void Verify_Events()
  237.   {
  238.   int i,j;
  239.   int hrs,mins;
  240.   long minutes;
  241.   int day;
  242.   if( !Eflag )return;  /* exit if not requested */
  243.   printf("\n\nThere are %d events\n",cfg.EvNumber);
  244.   for( i=0; i< cfg.EvNumber; i++)
  245.     {
  246.     hrs = EventTab[i].EvDur / 60;
  247.     mins= EventTab[i].EvDur % 60;
  248.     printf("\nEvent Number: %d Duration:%d(%d:%02.2d)   ",i,EventTab[i].EvDur, hrs, mins);
  249.     printf("Event Type: %s\n", Look_Up(EventTab[i].EvType,EvnTypes,MAXTYPES) );
  250.     printf("Event Warning:%s\n",( cfg.codeBuf+EventTab[i].EvWarn) );
  251.     printf("Event Class:%s   ",Look_Up(EventTab[i].EvClass,EvCls,EVENT_CLASS_COUNT) );
  252.     printf("Event EvExitVal:%08.8lX :",EventTab[i].EvExitVal);
  253.     for (j = 0; j < 32; j++)
  254.       {
  255.       if (( 1l << j ) & EventTab[i].EvExitVal) printf("%d ", j + 1);
  256.       };
  257.     printf("\n");
  258.     hrs = EventTab[i].EvDur / 60;
  259.     mins= EventTab[i].EvDur % 60;
  260.     printf("Event Minutes: %d(%d:%02.2d)\n",EventTab[i].EvMinutes, hrs, mins);
  261.     day = 1;
  262.     minutes = EventTab[i].EvMinutes;
  263.     while( minutes >= 1440)
  264.       {
  265.       day <<= 1;
  266.       minutes -= 1440;
  267.       };
  268.     hrs = minutes / 60;
  269.     mins= minutes % 60;
  270.     printf("Event Day: %s  Start Time:%ld(%d:%02.2d)\n",Look_Up(day,EvnDays, MAXDAYS), minutes, hrs, mins);
  271.     switch (EventTab[i].EvClass)
  272.       {
  273.       case CL_ANYTIME_NET:
  274.         printf("Anytime DeadTime: %ld  Anytime Duration: %d\n",
  275.         EventTab[i].vars.Anytime.EvDeadTime, EventTab[i].vars.Anytime.EvAnyDur);
  276.         break;
  277.       case CL_AUTODOOR:
  278.         printf("AutoDoor for User:%s\n", EventTab[i].vars.EvUserName);
  279.         break;
  280.       case CL_REDIRECT:
  281.         printf("Redirect incoming: System:%s\n"
  282.         ,EventTab[i].vars.Redirect.EvSystem);
  283.         printf("Directory:%s Filename:%s\n",
  284.         (EventTab[i].vars.Redirect.EvHomeDir + cfg.codeBuf)
  285.         ,EventTab[i].vars.Redirect.EvFilename);
  286.         break;
  287.       };
  288.     };
  289.   }
  290.  
  291.  
  292.  
  293. void Verify_Room()
  294.   {
  295.   short Index;
  296.   for (Index = 0; Index < MAXROOMS; Index++)
  297.     {
  298.     if( Rflag )printf("\nRoom Slot #%d:",Index);
  299.     if(   roomTab[Index].rtflags.INUSE )
  300.       {
  301.       if( Index < 3 )
  302.         {
  303.         if( roomTab[Index].rtFlIndex != 0 )
  304.           {
  305.           printf("\nInitial Room not on Base Floor!\n");
  306.  
  307.           };
  308.  
  309.         };
  310.       if( Rflag )
  311.         {
  312.         printf("%20s Last Message:%ld Last Netted message:%ld\n",
  313.         roomTab[Index].rtname,roomTab[Index].rtlastMessage,roomTab[Index].rtlastNet);
  314.         printf("Floor Index:%d\n", roomTab[Index].rtFlIndex);
  315.         if( Index != MAILROOM)Process_Other_Room_Data(Index);
  316.         };
  317.       }
  318.     else if( Rflag )printf(" Not in use at this time\n");
  319.  
  320.     };
  321.   if( Nflag )Check_Shared();
  322.  
  323.   }
  324. void Do_Net_Data()
  325.   {
  326.   printf("\nNode Name:%-22s  Node Id: %s\n",netBuf.netName, netBuf.netId);
  327.   printf("Short Name:%c%c%c  Passwords: Our(%s) Their(%s)\n",
  328.   (isprint(netBuf.nbShort[0]) ? netBuf.nbShort[0] : '*'),
  329.   (isprint(netBuf.nbShort[1]) ? netBuf.nbShort[1] : '*'),
  330.   (isprint(netBuf.nbShort[2]) ? netBuf.nbShort[2] : '*'),
  331.   netBuf.OurPwd, netBuf.TheirPwd);
  332.   printf("baudCode:%c nbGen: %c access:%s\n",
  333.   netBuf.baudCode, netBuf.nbGen, netBuf.access);
  334.   printf("nbRoute:%d nbRouteGen:%d nbHiRouteInd: %d nbLastConnect: %x\n",
  335.   netBuf.nbRoute, netBuf.nbRouteGen, netBuf.nbHiRouteInd, netBuf.nbLastConnect);
  336.   }
  337.  
  338. void Check_Shared()
  339.   {
  340.   short netrover;
  341.   for( netrover=0; netrover < cfg.netSize; netrover++)
  342.     {
  343.     getNet(netrover,&netBuf);
  344.     Do_NetBuf_Data(netrover);
  345.     printf("\nnetTab[%d]:",netrover);
  346.     if( netTab[netrover].ntflags.in_use )
  347.       {
  348.       printf(" In use\n");
  349.       printf(" ntnmhash: %d  ntidhash: %d  Short name:%c%c%c Generation: %d\n",
  350.       netTab[netrover].ntnmhash,netTab[netrover].ntidhash,
  351.       (isprint(netTab[netrover].ntShort[0]) ? netTab[netrover].ntShort[0] : '*'),
  352.       (isprint(netTab[netrover].ntShort[1]) ? netTab[netrover].ntShort[1] : '*'),
  353.       (isprint(netTab[netrover].ntShort[2]) ? netTab[netrover].ntShort[2] : '*'),
  354.       netTab[netrover].ntGen);
  355.       Do_nflags(&netTab[netrover].ntflags);
  356.       Do_Multi_Net_Data(netTab[netrover].ntMemberNets);
  357.       Do_Shared_Room(netTab[netrover].netTRooms);
  358.       Do_Net_Data();
  359.       }
  360.     else
  361.       {
  362.       printf("Not in use\n");
  363.  
  364.       };
  365.  
  366.     };
  367.  
  368.   }
  369. void Do_nflags(ntflags)
  370. struct nflags *ntflags;
  371.   {
  372.   Do_Boolean("normal_mail   ",ntflags->normal_mail,FALSE);
  373.   Do_Boolean("in_use        ",ntflags->in_use,FALSE);
  374.   Do_Boolean("room_files    ",ntflags->room_files,TRUE);
  375.   Do_Boolean("local         ",ntflags->local,FALSE);
  376.   Do_Boolean("spine         ",ntflags->spine,FALSE);
  377.   Do_Boolean("send_files    ",ntflags->send_files,TRUE);
  378.   Do_Boolean("is_spine      ",ntflags->is_spine,FALSE);
  379.   Do_Boolean("OtherNet      ",ntflags->OtherNet,FALSE);
  380.   Do_Boolean("HasRouted     ",ntflags->HasRouted,TRUE);
  381.   Do_Boolean("RouteFor      ",ntflags->RouteFor,FALSE);
  382.   Do_Boolean("RouteTo       ",ntflags->RouteTo,FALSE);
  383.   Do_Boolean("Stadel        ",ntflags->Stadel,TRUE);
  384.   Do_Boolean("RouteLock     ",ntflags->RouteLock,FALSE);
  385.   Do_Boolean("ExternalDialer",ntflags->ExternalDialer,FALSE);
  386.   Do_Boolean("NoDL          ",ntflags->NoDL,TRUE);
  387.   Do_Boolean("MassTransfer  ",ntflags->MassTransfer,FALSE);
  388.   Do_Boolean("Zip           ",ntflags->Zip,FALSE);
  389.   Do_Boolean("Zoo           ",ntflags->Zoo,TRUE);
  390.   Do_Boolean("Arc           ",ntflags->Arc,FALSE);
  391.   Do_Boolean("Lha           ",ntflags->Lha,FALSE);
  392.  
  393.   }
  394. void Do_Multi_Net_Data(MN)
  395. MULTI_NET_DATA MN;
  396.   {
  397.   short i;
  398.   printf(" Member of Nets:");
  399.   for(i=0; i<MAX_NET-1;i++) if( ((1<<i) & MN) !=0 )printf(" %d",i+1);
  400.   printf("\n");
  401.   if( (MN & 0x80000000) != 0)printf("Priority Mail\n");
  402.  
  403.   }
  404. void Do_Shared_Room(nRms)
  405. SharedRoom *nRms;
  406.   {
  407.   int slot;
  408.   for(slot = 0; slot < SHARED_ROOMS; slot++)
  409.     {
  410.     if( (nRms->srgen & 0x8000) )
  411.       {
  412.       printf(" \nSR[%d]:  lM:%ld  Mode:",slot,  nRms->lastMess);
  413.       switch (CGetMode(nRms->mode))
  414.         {
  415.         case            PEON: printf("Peon            "); break;
  416.         case        REG_HOST: printf("Reg Host        "); break;
  417.         case        BACKBONE: printf("Backbone        "); break;
  418.         case   PASS_BACKBONE: printf("Passive Backbone"); break;
  419.         case ACTIVE_BACKBONE: printf("Active Backbone "); break;
  420.         default:              printf("Unknown");
  421.         };
  422.       printf("  F:%s srgen:%x srslot: %d",
  423.       (GetFA(nRms->mode) != 0 ? "YES":"NO "),nRms->srgen,nRms->srslot);
  424.       };
  425.       nRms++;
  426.     };
  427.   }
  428. void Check_codeBuf(str,data,control)
  429. char *str;
  430. long data;
  431. short control;   /* TRUE - Newline if verbose operation */
  432.   {
  433.   if( data >= MAXCODE )
  434.     {
  435.     printf("\nInvalid values(%d) for offset:%s\n",data,str);
  436.  
  437.     }
  438.   else
  439.     {
  440.     if(Vflag)
  441.       {
  442.       char *d;
  443.       d = &cfg.codeBuf[0];
  444.       printf("%-20s(%ld):%s%c",str,data,
  445.       (data == 0 ? "Undefined" : &d[data]),(control ? '\n':' '));
  446.  
  447.       };
  448.  
  449.     };
  450.  
  451.   }
  452. void Verify_Config()
  453.   {
  454.   short i;
  455.   if( Vflag )
  456.     {
  457.     printf("\nmaxMSector:%d ",cfg.maxMSector);
  458.     printf("Message Old::%ld New:%ld\n",cfg.oldest,cfg.newest);
  459.  
  460.     };
  461.   Check_codeBuf("Node Name",  cfg.nodeName,TRUE);
  462.   Check_codeBuf("Node Id",    cfg.nodeId,FALSE);
  463.   Check_codeBuf("Node Domain",cfg.nodeDomain,TRUE);
  464.   Check_codeBuf("Node Title", cfg.nodeTitle,TRUE);
  465.   Check_codeBuf("Main Floor", cfg.MainFloor,FALSE);
  466.   Check_codeBuf("Base Room",  cfg.bRoom, TRUE);
  467.   for(i=0;i<7;i++)
  468.     {
  469.     Check_codeBuf("Dial Prefix",cfg.DialPrefixes[i],TRUE);
  470.  
  471.     };
  472.   Check_codeBuf("Dial Suffix",cfg.netSuffix,TRUE);
  473.   if( Vflag )
  474.     {
  475.     printf("Max File:%d Area Size: %d receptArea:%s\n",
  476.     cfg.maxFileSize, cfg.sizeArea, &cfg.receptArea);
  477.     printf("Sysop:%s CryptSeed:%d InitColumns:%d LoginAttempts:%d Audit: %d(%s)\n",
  478.     cfg.SysopName,cfg.cryptSeed,cfg.InitColumns,cfg.LoginAttempts,
  479.     cfg.Audit,( cfg.Audit == 0 ? "None":(cfg.Audit == 1? "Normal":"No Net") ) );
  480.     printf("  homeArea:%s\n",&cfg.homeArea);
  481.     printf("   msgArea:%s\n",&cfg.msgArea);
  482.     printf("  msg2Area:%s\n",&cfg.msg2Area);
  483.     printf("   logArea:%s\n",&cfg.logArea);
  484.     printf("  roomArea:%s\n",&cfg.roomArea);
  485.     printf("   netArea:%s\n",&cfg.netArea);
  486.     printf("domainArea:%s\n",&cfg.domainArea);
  487.     printf(" auditArea:%s\n",&cfg.auditArea);
  488.     printf(" floorArea:%s\n",&cfg.floorArea);
  489.     printf("  holdArea:%s\n",&cfg.holdArea);
  490.     printf("sysBaud:%d netSiz:%d DomainHandlers:%d\n"
  491.     ,cfg.sysBaud,cfg.netSize,cfg.DomainHandlers);
  492.  
  493.     };
  494.   Check_codeBuf("Mail Hub",cfg.MailHub,TRUE);
  495.   if( Vflag )
  496.     {
  497.     printf("Domain display Format:%s\n",&cfg.DomainDisplay[0]);
  498.     printf("EvNumber:%d weAre:%d paramVers:%d\n",cfg.EvNumber,cfg.weAre,cfg.paramVers);
  499.     printf("MaxLog size:%d ",cfg.MAXLOGTAB);
  500.     printf("Mail  Slots:%d ",cfg.MailSlots);
  501.     printf("Msgs Per room:%d\n",cfg.MsgsPerrm);
  502.     printf("Max Rooms:%d ",cfg.MaxRooms);
  503.     printf("Shared Rooms:%d\n",cfg.SharedRooms);
  504.     printf("Next msg slot: %d/%d Anon Mail Max Length:%d\n",
  505.     cfg.catChar,cfg.catSector,cfg.AnonMailLength);
  506.     printf("Log entries are %d in size\n",cfg.sizeLTentry);
  507.     printf("Console Timeout:%d\n",cfg.ConTimeOut);
  508.     printf("Sysop Archive:%s\n",cfg.SysopArchive);
  509.     Do_Boolean("HoldOnLost    ", cfg.BoolFlags.HoldOnLost    ,FALSE);
  510.     Do_Boolean("mirror        ", cfg.BoolFlags.mirror        ,FALSE);
  511.     Do_Boolean("unlogEnterOk  ", cfg.BoolFlags.unlogEnterOk  ,TRUE);
  512.     Do_Boolean("unlogReadOk   ", cfg.BoolFlags.unlogReadOk   ,FALSE);
  513.     Do_Boolean("nonAideRoomOk ", cfg.BoolFlags.nonAideRoomOk ,FALSE);
  514.     Do_Boolean("noMail        ", cfg.BoolFlags.noMail        ,TRUE);
  515.     Do_Boolean("noChat        ", cfg.BoolFlags.noChat        ,FALSE);
  516.     Do_Boolean("netParticipant", cfg.BoolFlags.netParticipant,FALSE);
  517.     Do_Boolean("aideSeeAll    ", cfg.BoolFlags.aideSeeAll    ,TRUE);
  518.     Do_Boolean("debug         ", cfg.BoolFlags.debug         ,FALSE);
  519.     Do_Boolean("NetDft        ", cfg.BoolFlags.NetDft        ,FALSE);
  520.     Do_Boolean("SysopEditor   ", cfg.BoolFlags.SysopEditor   ,TRUE);
  521.     Do_Boolean("IsDoor        ", cfg.BoolFlags.IsDoor        ,FALSE);
  522.     Do_Boolean("RouteMail     ", cfg.BoolFlags.RouteMail     ,FALSE);
  523.     Do_Boolean("DoorDft       ", cfg.BoolFlags.DoorDft       ,TRUE);
  524.     Do_Boolean("AnonSessions  ", cfg.BoolFlags.AnonSessions  ,FALSE);
  525.     Do_Boolean("DL_Default    ", cfg.BoolFlags.DL_Default    ,FALSE);
  526.     Do_Boolean("NetScanBad    ", cfg.BoolFlags.NetScanBad    ,TRUE);
  527.     printf("SysOp Editor:%s\n",cfg.DepData.Editor);
  528.     printf("SysOp Editor Area:%s\n",cfg.DepData.EditArea);
  529.     printf("Sysdependant Modem:%s\n",cfg.DepData.ModemSetup);
  530.     printf("Sysdependant Modem Init:%s\n",cfg.DepData.HiSpeedInit);
  531.     printf("Sysdependant Modem Unit %d Device:%s\n"
  532.     , cfg.DepData.UnitNumber, cfg.DepData.DevName);
  533.     printf("Sysdependant clock:%d\n",cfg.DepData.Clock);
  534.     printf("Sysdependant Lockport:%d\n",cfg.DepData.LockPort);
  535.     printf("Sysdependant width: %d Height: %d Depth: %d\n",
  536.     cfg.DepData.ScreenWidth,cfg.DepData.ScreenHeight,cfg.DepData.ScreenDepth);
  537.     printf("Sysdependant Colors:%d %d\n",cfg.DepData.Color0, cfg.DepData.Color1);
  538.  
  539.     };
  540.  
  541.   }
  542. void Do_Boolean(str,flag,control)
  543. char *str;
  544. short flag,control;
  545.   {
  546.   printf("%s: %s%c",str,(flag!=0 ? "Yes  " : "No   "),(control ? '\n' : ' ') );
  547.  
  548.   }
  549. void Verify_Log()
  550.   {
  551.   short i;
  552.   initLogBuf(&logBuf);
  553.   for ( i = 0; i < cfg.MAXLOGTAB; i++ )
  554.     {
  555.     getLog(&logBuf,i);
  556.     if( Lflag )printf("\nlog:%-4d",i);
  557.     if (logBuf.lbflags.L_INUSE)
  558.       {
  559.       showlog(i);
  560.       if( logBuf.lbwidth < 40 || logBuf.lbwidth > 132 )
  561.         {
  562.         printf("Log:%d,  %s terminal width = %d\n",i,logBuf.lbname,logBuf.lbwidth);
  563.  
  564.         };
  565.       if( logBuf.lbnulls > 50 )
  566.         {
  567.         printf("Log:%d,  %s terminal nulls = %d\n",i,logBuf.lbname,logBuf.lbnulls);
  568.  
  569.         };
  570.       if( logBuf.credit < 0 || logBuf.credit > 1000)
  571.         {
  572.         printf("Log:%d,  %s Long Distance credits = %d\n",i,logBuf.lbname,logBuf.credit);
  573.  
  574.         };
  575.  
  576.       }
  577.     else
  578.       {
  579.       if( Lflag )printf(" Not in use at this time\n");
  580.  
  581.       };
  582.  
  583.     };
  584.  
  585.   }
  586. void showlog(i)
  587. int i;
  588.   {
  589.   if( Lflag )
  590.     {
  591.     printf("%4d: %-20s",i,logBuf.lbname);
  592.     printf("%-20s",logBuf.lbpw);
  593.     ShowHash();
  594.     printf(" %d col. Last Call:%s\n",logBuf.lbwidth, LastOn(logBuf.lblaston, TRUE));
  595.     Do_Boolean("AIDE Status       ",logBuf.lbflags.AIDE      ,FALSE);
  596.     Do_Boolean("Expert User       ",logBuf.lbflags.EXPERT    ,FALSE);
  597.     Do_Boolean("Network Privilege ",logBuf.lbflags.NET_PRIVS ,TRUE);
  598.     Do_Boolean("Door Privilege    ",logBuf.lbflags.DOOR_PRIVS,FALSE);
  599.     Do_Boolean("Download Privilege",logBuf.lbflags.DL_PRIVS  ,FALSE);
  600.     Do_Boolean("Permanent Account ",logBuf.lbflags.PERMANENT ,TRUE);
  601.     Do_Boolean("Floor mode        ",logBuf.lbflags.FLOORS    ,FALSE);
  602.     Do_Boolean("TWIT User         ",logBuf.lbflags.TWIT      ,FALSE);
  603.     Do_Boolean("RUGGIE User       ",logBuf.lbflags.RUGGIE    ,TRUE);
  604.     Do_Boolean("Active Account    ",logBuf.lbflags.L_INUSE   ,FALSE);
  605.     Do_Boolean("LF FLAG           ",logBuf.lbflags.LFMASK    ,FALSE);
  606.     Do_Boolean("OLD STYLE         ",logBuf.lbflags.OLDTOO    ,TRUE);
  607.     Do_Boolean("HALF DUPLEX       ",logBuf.lbflags.HALF_DUP  ,FALSE);
  608.     Do_Boolean("ALT. Read Messages",logBuf.lbflags.ALT_RE    ,FALSE);
  609.     Do_Boolean("Room Name Prompt  ",logBuf.lbflags.NoPrompt  ,TRUE);
  610.  
  611.     };
  612.  
  613.   }
  614. void ShowHash()
  615.   {
  616.   int i;
  617.   for (i = 0; i < cfg.MAXLOGTAB; i++)
  618.   if (logTab[i].ltlogSlot == thisLog)
  619.     {
  620.     printf("ltab=%02d, hash=%02d\n ", logTab[i].ltpwhash, hash(logBuf.lbpw));
  621.  
  622.     }
  623.  
  624.   }
  625. void Do_Door_Data()
  626.   {
  627.   FILE        *fd;
  628.   SYS_FILE    name;
  629.   DoorData    DoorInfo;
  630.   extern char *READ_ANY;
  631.   short flag;
  632.   makeSysName(name, DOOR_DATA, &cfg.roomArea);
  633.   if ((fd = safeopen(name, READ_ANY)) == NULL)
  634.     {
  635.     if( Dflag )printf("No doors appear to be available.\n ");
  636.     return;
  637.  
  638.     };
  639.   /* process each door */
  640.   while ( fread((char *)&DoorInfo, sizeof DoorInfo, 1, fd) != 0)
  641.     {
  642.     if( Dflag)
  643.       {
  644.       printf("\nDoor Code:%s Program:%s Room:%s\n"
  645.       ,DoorInfo.entrycode,DoorInfo.program,DoorInfo.RoomName);
  646.       printf("Parameters:%s\n",DoorInfo.parameters);
  647.       printf("Description:%s\n",DoorInfo.description);
  648.       printf("Location:%s TimeLimit:%d\n",DoorInfo.location,DoorInfo.TimeLimit);
  649.       flag = (DOOR_AIDE    & DoorInfo.flags) ? 1:0;
  650.       Do_Boolean("   AIDE",flag,FALSE);
  651.       flag = (DOOR_SYSOP   & DoorInfo.flags) ? 1:0;
  652.       Do_Boolean("  SYSOP",flag,FALSE);
  653.       flag = (DOOR_CON     & DoorInfo.flags) ? 1:0;
  654.       Do_Boolean("Console",flag,TRUE);
  655.       flag = (DOOR_MODEM   & DoorInfo.flags) ? 1:0;
  656.       Do_Boolean("  Modem",flag,FALSE);
  657.       flag = (DOOR_AUTO    & DoorInfo.flags) ? 1:0;
  658.       Do_Boolean("   Auto",flag,FALSE);
  659.       flag = (DOOR_NEWUSER & DoorInfo.flags) ? 1:0;
  660.       Do_Boolean("NewUser",flag,TRUE);
  661.       printf("\n");
  662.  
  663.       };
  664.  
  665.     };
  666.  
  667.   }
  668. /*
  669. * doMessages()
  670. *
  671. * This function loops thru the msg file until finished.  It accumulates
  672. * statistics, etc.
  673. */
  674. extern MessageBuffer  msgBuf; /* The -sole- message buffer      */
  675. extern FILE *msgfl, *msgfl2;
  676.  
  677. struct counts
  678.   {
  679.   struct counts *next;
  680.   char name[20];    /* room name */
  681.   long  messages;   /* number of messages in the room */
  682.   long bytes;       /* total space the message uses */
  683.  
  684.   };
  685. struct counts *Header = NULL;
  686.  
  687. void Process_Msg(MessageBuffer  *msg)
  688.   {
  689.   struct counts *ptr;
  690. /*
  691. ** User names Statistics
  692. */
  693.   if( Header == NULL )
  694.     {
  695.     Header = ptr = malloc(sizeof(struct counts));
  696.     strcpy(ptr->name, msg->mbauth);
  697.     ptr->messages = 0;
  698.     ptr->bytes    = 0;
  699.     ptr->next     = NULL;
  700.     }
  701.   else
  702.     {
  703.     ptr = Header;
  704.     while( ptr != NULL )
  705.       {
  706.       if( strcmp(msg->mbauth,ptr->name)== 0 )break;
  707.       ptr = ptr->next;
  708.       };
  709.     if( ptr == NULL )
  710.       {
  711.       ptr = malloc(sizeof(struct counts));
  712.       strcpy(ptr->name, msg->mbauth);
  713.       ptr->messages = 0;
  714.       ptr->bytes    = 0;
  715.       ptr->next     = Header;
  716.       Header        = ptr;
  717.       };
  718.     };
  719.  
  720.   ptr->messages++;
  721.   ptr->bytes += MsgLen(msg);
  722. /*
  723. ** Room Statistics
  724. */
  725.   ptr = Header;
  726.   while( ptr != NULL )
  727.     {
  728.     if( strcmp(msg->mbroom,ptr->name)== 0 )break;
  729.     ptr = ptr->next;
  730.     };
  731.   if( ptr == NULL )
  732.     {
  733.     ptr = malloc(sizeof(struct counts));
  734.     strcpy(ptr->name, msg->mbroom);
  735.     ptr->messages = 0;
  736.     ptr->bytes    = 0;
  737.     ptr->next     = Header;
  738.     Header        = ptr;
  739.     };
  740.   ptr->messages++;
  741.   ptr->bytes += MsgLen(msg);
  742.  
  743.   }
  744.  
  745. void Do_Room_Stats(long total)
  746.   {
  747.   struct counts *ptr;
  748.   printf("Total of %ld messages\n",total);
  749.   ptr = Header;
  750.   while( ptr )
  751.     {
  752.     if( ptr->messages <= 0)ptr->messages = 1;
  753.     printf("Name:%20s Messages:%10ld Bytes:%10ld Aver:%10ld\n"
  754.     ,ptr->name,ptr->messages, ptr->bytes, ptr->bytes/ptr->messages);
  755.     ptr = ptr->next;
  756.     };
  757.   }
  758.  
  759. void Verify_Messages()
  760.   {
  761.   MSG_NUMBER msg, firstMessage;
  762.   MSG_NUMBER total;     /* For stat keeping. */
  763.   extern struct mBuf mFile1;
  764.   if( !Mflag ) return;
  765.   fprintf(stderr, "Mulching...\n");
  766.   InitMsgBase();
  767.   startAt(msgfl, &mFile1, 0, 0);
  768.   getMessage(getMsgChar, FALSE, TRUE, TRUE);
  769.   firstMessage = atol(msgBuf.mbId);
  770.   Do_Message(&msgBuf);
  771.   msg = firstMessage -1;
  772.   total = 1;
  773.   while (msg != firstMessage)
  774.     {
  775.     total++;
  776.     getMessage(getMsgChar, FALSE, TRUE, TRUE);
  777.     Do_Message(&msgBuf);
  778.     msg = atol(msgBuf.mbId);
  779.  
  780.     }
  781.   Do_Room_Stats(total);
  782.  
  783.   }
  784. void Do_Message(MessageBuffer  *msg)
  785.   {
  786.   Process_Msg(msg);
  787.   if( MControl == 'A')
  788.     {
  789.     printf("\nMsg: %6d Sector ID: %6d Author:%s To:%s "
  790.     ,  msg->mbheadChar, msg->mbheadSector, msg->mbauth, msg->mbto);
  791.     printf("Name:%s ID:%s Room:%s",  msg->mboname,  msg->mborig,  msg->mbroom);
  792.     printf("\n");
  793.     }
  794.   else if( MControl == 'P' )
  795.     {
  796.     printf("Message %4d Sector ID: %5d Author:%16s",  msg->mbheadChar, msg->mbheadSector, msg->mbauth);
  797.     if( sfflag ) printf("\n");
  798.     printf(" Date:%8s Time:%8s Local Id:%10s",  msg->mbdate,  msg-> mbtime,  msg-> mbId);
  799.     if( sfflag ) printf("\n");
  800.     printf(" Human:%15s ID:%14s Room:%15s",  msg->mboname,  msg->mborig,  msg->mbroom);
  801.     if( sfflag ) printf("\n");
  802.     printf(" Origin:%s To:%s",  msg->mbsrcId,  msg->mbto);
  803.     if( sfflag ) printf("\n");
  804.     printf(" Route:%s", msg->mbaddr);
  805.     if( sfflag ) printf("\n");
  806.     printf(" OtherNet:%s",msg->mbOther);
  807.     if( sfflag ) printf("\n");
  808.     printf(" reply:%s Domain:%0s",msg->mbreply, msg->mbdomain);
  809.     printf("\n");
  810.     };
  811.   }
  812. /*
  813. * MsgLen()
  814. *
  815. * This function figures out the byte usage of the message.
  816. */
  817. int MsgLen(MessageBuffer  *msg)
  818.   {
  819.   return  (int) (       strlen(msg->mbtext)  + strlen(msg->mbauth) +
  820.   strlen(msg->mbdate)  + strlen(msg->mbtime) +
  821.   strlen(msg->mbId)    + strlen(msg->mboname) +
  822.   strlen(msg->mborig)  + strlen(msg->mbroom) +
  823.   strlen(msg->mbsrcId) + strlen(msg->mbto) +
  824.   strlen(msg->mbaddr)  + strlen(msg->mbOther) );
  825.  
  826.   }
  827. void Do_NetBuf_Data(int slot)
  828.   {
  829.   printf("\nSlot:%2d Node Name:%-22s  Node Id: %s\n",slot,netBuf.netName, netBuf.netId);
  830.   printf("Short Name:%c%c%c  Passwords: Our(%s) Their(%s)\n",
  831.   (isprint(netBuf.nbShort[0]) ? netBuf.nbShort[0] : '*'),
  832.   (isprint(netBuf.nbShort[1]) ? netBuf.nbShort[1] : '*'),
  833.   (isprint(netBuf.nbShort[2]) ? netBuf.nbShort[2] : '*'),
  834.   netBuf.OurPwd, netBuf.TheirPwd);
  835.   printf("baudCode:%d nbGen: %d access:%s\n",
  836.   (int)netBuf.baudCode, (int)netBuf.nbGen, netBuf.access);
  837.   printf("nbRoute:%d nbRouteGen:%d nbHiRouteInd: %d nbLastConnect: %x\n",
  838.   netBuf.nbRoute, netBuf.nbRouteGen, netBuf.nbHiRouteInd, netBuf.nbLastConnect);
  839.   Do_nflags(&netBuf.nbflags);
  840.   Do_Multi_Net_Data(netBuf.MemberNets);
  841.   Do_Shared_Room(netBuf.netRooms);
  842.  
  843.   }
  844.  
  845. void  Process_Other_Room_Data(int Index)
  846.   {
  847.   int i;
  848.   int count;
  849.   MSG_NUMBER msgNo;
  850.   getRoom(Index);
  851.   printf("Slot: %d %s\n ",Index, roomBuf.rbname);
  852.   printf("     rbgen:%d  rbFlIndex: %d ShareType:");
  853.   switch( roomBuf.rbShareType)
  854.     {
  855.     case             PEON: printf("PEON\n"); break;
  856.     case         REG_HOST: printf("REG_HOST\n"); break;
  857.     case         BACKBONE: printf("BACKBONE\n"); break;
  858.     case    PASS_BACKBONE: printf("PASSIVE\n"); break;
  859.     case  ACTIVE_BACKBONE: printf("ACTIVE\n"); break;
  860.     default:               printf("Unknown\n");
  861.     };
  862.   printf("Room Area:");
  863.   if (roomBuf.rbflags.ISDIR)
  864.     {
  865.     printf("%s\n", &roomBuf.rbArea);
  866.     }
  867.   else printf("No Directory\n");
  868.   Do_Boolean("Public            ",roomBuf.rbflags.PUBLIC,         FALSE);
  869.   Do_Boolean("Directory         ",roomBuf.rbflags.ISDIR,          FALSE);
  870.   Do_Boolean("Permanent         ",roomBuf.rbflags.PERMROOM,       TRUE);
  871.   Do_Boolean("Skipped           ",roomBuf.rbflags.SKIP,           FALSE);
  872.   Do_Boolean("Uploadable        ",roomBuf.rbflags.UPLOAD,         FALSE);
  873.   Do_Boolean("Downloadable      ",roomBuf.rbflags.DOWNLOAD,       TRUE);
  874.   Do_Boolean("Shared            ",roomBuf.rbflags.SHARED,         FALSE);
  875.   Do_Boolean("Archived          ",roomBuf.rbflags.ARCHIVE,        FALSE);
  876.   Do_Boolean("Anonymous         ",roomBuf.rbflags.ANON,           TRUE);
  877.   Do_Boolean("Net Downloadable  ",roomBuf.rbflags.NO_NET_DOWNLOAD,FALSE);
  878.   Do_Boolean("Invitational      ",roomBuf.rbflags.INVITE,         FALSE);
  879.   Do_Boolean("Automaticly Netted",roomBuf.rbflags.AUTO_NET,       TRUE);
  880.   Do_Boolean("All Users Netted  ",roomBuf.rbflags.ALL_NET,        FALSE);
  881.   Do_Boolean("Read Only         ",roomBuf.rbflags.READ_ONLY,      TRUE);
  882.  
  883.   count = 0;
  884.   for (i = 0;  i < MSGSPERRM;   i++)
  885.     {
  886.     msgNo = roomBuf.msg[i].rbmsgNo & S_MSG_MASK;
  887.     if (msgNo >= cfg.oldest) count++;
  888.     };
  889.   printf("There are %d messages in this room\n");
  890.   }
  891.